#!/bin/sh

for lang in cpp java j2me; do rm -R -f $lang/*/gen/* ; done

PATH=./out/Default:$PATH

./out/Default/protoc \
  --proto_path=../third_party/protobuf/trunk/src \
  --proto_path=proto \
  proto/protoserv/protocol.proto \
  proto/protoserv/transport.proto \
  --cpp_out=cpp/runtime/gen \
  --java_out=java/runtime/gen \

request_java_file="java/runtime/gen/com/googlecode/protoserv/RequestProto.java"
java_patch="public java.util.Map<com.google.protobuf.Descriptors.FieldDescriptor, Object> getExtensionFields() { return super.getExtensionFields(); }"
sed "s|// @@protoc_insertion_point(class_scope:protoserv.RequestProto)|$java_patch|" -i $request_java_file

#  --python_out=python/runtime/pylib \
#  proto/protoserv/services.proto \

./out/Default/protoc \
  --proto_path=../third_party/protobuf/trunk/src \
  --proto_path=proto \
  proto/samples/calc.proto \
  --cpp_out=cpp/samples/calc/gen \
  --java_out=java/samples/calc/gen \
  --java_rpc_out=java/samples/calc/gen \

#--cpp_rpc_out=cpp/samples/calc/gen \
#protoc \
#  --proto_path=proto \
#  proto/protoserv/protocol-light.proto \
#  --j2me_out=j2me/client/gen \

#cp out/Default/protobuf-java-2.3.0.jar java/runtime/j2se/lib
#cp out/Default/protobuf-j2me-2.3.0.jar java/runtime/j2me/lib
